package edu.scsu.csci.core;

import java.util.ArrayList;
import java.util.List;

import edu.scsu.csci.IExecutionError;
import edu.scsu.csci.IExecutionErrors;



/**
 *
 * @author Maqbool Khan
 * @since jdk 1.5
 * @see
 * @viz.diagram ExecutionErrors.tpx
 */
public class ExecutionErrors implements IExecutionErrors {

	/**
	 * validation error list.
	 */
	private List<IExecutionError> list;
	
	/**
	 * @param list
	 */
	public ExecutionErrors() {
		this.list = new ArrayList<IExecutionError>();
	}
	
	/**
	 * @param list
	 */
	public ExecutionErrors(List<IExecutionError> list) {
		this.list = list;
	}
	
	/* (non-Javadoc)
	 * @see edu.scsu.csci.core.IExecutionErrors#addError(edu.scsu.csci.core.ExecutionError)
	 */
	public void addError(IExecutionError executionError){
		this.list.add(executionError);
	}
	
	/* (non-Javadoc)
	 * @see edu.scsu.csci.core.IExecutionErrors#getList()
	 */
	public List<IExecutionError> getList() {
		return list;
	}

	/* (non-Javadoc)
	 * @see edu.scsu.csci.core.IExecutionErrors#setList(java.util.List)
	 */
	public void setList(List<IExecutionError> list) {
		this.list = list;
	}

	/* (non-Javadoc)
	 * @see edu.scsu.csci.IExecutionErrors#hasErrors()
	 */
	public boolean hasErrors() {
		return !this.list.isEmpty();
	}

	/* (non-Javadoc)
	 * @see edu.scsu.csci.IExecutionErrors#errorCount()
	 */
	public int getErrorCount() {
		return this.list.size();
	}
	
	/**
	 * 
	 */
	public void clear()	{
		if(this.list != null){
			this.list.clear();
		}
	}
		
}
